#ifndef JAE_TEXTURMANAGER_H_
#define JAE_TEXTURMANAGER_H_

//Teste Betriebsyste
#if (defined(_Windows) || defined(__WIN32__) || defined(_WIN32) || defined(__WIN__))

#define THIS_IS_WINDOWS
#include <windows.h>

#elif (defined(__unix__) || defined(__unix) || defined(__linux__))

#include <X11/Xlib.h>
#define THIS_IS_UNIX_OR_LINUX

//ohne diese #undef's kompiliert Qt unter Unix nicht:
// "#error qdatastream.h must be included before any header file that defines Status"
#undef Status
// "#error qmetatype.h must be included before any header file that defines Bool"
#undef Bool
// /usr/include/qt4/QtCore/qnamespace.h:
#undef CursorShape
// /usr/include/qt4/QtCore/qcoreevent.h:
#undef None
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
#undef FontChange
/*
//"#error qmetatype.h must be included before any header file that defines Bool"
#ifdef Bool
#undef Bool
#endif 
*/
/*
#ifdef Unsorted
#undef Unsorted
#endif
*/

#endif //if Unix or Linux

#include <QApplication>
#include <QGLWidget>
#include <QPushButton>
#include <QTime>
#include <QTimer>
#include <QResizeEvent>
#include "logger.h"

/****************************************************//**
 * Project-Namespace
 ********************************************************/
namespace jae
{

/****************************************************//**
 * The Texturemanager tries to prevent loading a texture 
 * twice.
 ********************************************************/
class TextureManager
{
    /****************************************************//**
     * An Element of the list in the TexturManager
     ********************************************************/
    struct ListElem 
    {
        GLuint _textureIndex;
        char* _pTextureFileName;
        
        ListElem() : 
            _textureIndex(0), _pTextureFileName(NULL) 
        {}
    };
    
    public:
        TextureManager(QGLWidget* aSharedGLContext);
        ~TextureManager();
        GLuint addElem(const char *aFileName);
        void delElem(GLuint aIndex);
        GLuint duplicateCheck(const char *aFileName);
        bool isEmpty();
        void writeToLog();

    protected:
    private:
        std::list<ListElem> _textureList;
        QGLWidget* _pSharedGLContext;
};

}//Namespace

#endif /*JAE_TEXTURMANAGER_H_*/
